<html>
<head>
<script language="javascript">
function checkAll(){
 for (var i=0;i<document.forms[0].elements.length;i++)
 {
  var e=document.forms[0].elements[i];
  if ((e.name != 'allbox') && (e.type=='checkbox'))
  {
   e.checked=document.forms[0].allbox.checked;
  }
 }
}
</script>
</head>

<body>
<form>
<input type="checkbox" value="on" name="allbox" onclick="checkAll();"/> Check all<br />

<h3>Fruit</h3>
<input type="checkbox" value="on" name="apples" /> Apples<br/>
<input type="checkbox" value="on" name="oranges" /> Oranges<br/>
<input type="checkbox" value="on" name="bananas" /> Bananas<br/>

</form>
</body>
</html>